<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="../../css/layui.css">
    <script type="text/javascript" src="../../layui.js"></script>
    <script type="text/javascript" src="../../js/jquery-2.2.4.js"></script>
</head>
<body>

<div style="margin-top: 1%;">
    <form class="layui-form" action="">
        <div class="layui-inline" style="margin-left: 450px;">
            <div class="layui-input-inline">
                <input type="text" id="macfjval"   style="width: 220px;"  placeholder="请输入房间号/mac地址/ip"autocomplete="off" class="layui-input">
            </div>
        </div>


        <div class="layui-inline">
            <button type="button" class="layui-btn" id="btnSearch">搜索</button>
        </div>
    </form>
</div>
<div style="padding-left: 50px;">
    <caption style="margin-left: 40px;"><span >
                <button type="button" class="btn btn-primary layui-btn"  onclick="method5('tableExcel')">
                    <span class="glyphicon glyphicon-folder-open">导出Excel</span>
                </button>
            </span>
    </caption>
</div>
<table class="layui-table" id="data2" lay-filter="data2">

</table>
</body>
<script src="/js/layui/layui.all.js"></script>
<script src="/admin/js/token.js"></script>
<script type="text/html" id="tol">
    <div>
        <div style="float:left;">终端列表</div>
        <div style="float:right;margin-right: 50px">共有数据：<span id="count"></span>条</div>
    </div>

</script>

<script type="text/html" id="caozuo">
    <ul  class="kit-menu-child layui-anim layui-anim-upbit">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    </ul>


</script>

</html>
<script type="text/javascript">
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table = layui.table
            , layer = layui.layer
            , util = layui.util;
            var s=layui.data("s");
            var gid=s.group.group_id;
            var stationid=localStorage.getItem('groupStationId');
            table.render({
                elem: '#data2'
                ,  id: "t"
                ,  toolbar:"#tol"
                , method: 'get'
                ,url:'/admin/terminal/groupQueryTerminall?groupId='+gid+'&terminalStation='+stationid
                ,cols: [[
                    {field:'terminal_id', title: '终端编号',
                        align: "center"}
                    ,{field:'terminal_ip', title: 'IP地址',width:"10%",
                        align: "center"}
                    ,{field:'terminal_mac',
                        align: "center", title: 'MAC地址',width:"14%",}
                    ,{field:'terminal_key',
                        align: "center",  title: '密码'}
                    ,{field:'station_bh', title: '站点编号',
                        align: "center"} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
                    ,{field:'terminal_room',
                        align: "center", title: '房间号'}
                    ,{field:'terminal_line',
                        align: "center",  title: '是否在线'}
                    ,{field:'group_name',
                        align: "center", title: '所属分组'}
                    ,{field:'terminal_version_code',
                        align: "center", title:'版本',width:"5%",}
                    ,{field:'terminal_system_model',
                        align: "center", title: '型号',width:"7%",}
                    ,{
                        title:'操作',
                        align:'center',
                        toolbar:'#caozuo',
                        fixed: 'right'
                    }
                ]],
                page: true,
                done: function(res, curr, count){
                    $("#count").html(count);
                }
            });


        table.on('tool(data2)',function(obj){
            var getdata=obj.data; //获取当前行数据
            var layEvent=obj.event; //获取lay-event对应的值,(也可以是表头的event参数对应的值)
            var tr=obj.tr; //获取当前行tr的DOM对象(如果有的话)
            switch(layEvent){

                case "edit":

                    layui.data("s",{key:"terminal",value:getdata});
                    layer.open({
                        title:"修改终端",
                        type:2,
                        content:'/admin/station_config/views/layui/terminal_edit_group.html',
                        area:['520px','350px'],

                        end: function () {
                            location.reload();
                        }
                    });

                    break;
            }
        });

        $("#btnSearch").click(function(){
            table.reload("t",{
                where:{
                    macfj:$("#macfjval").val()
                },
                page:{
                    curr:1
                }
            });
        });




</script>
